<template>
  <div class="detail-content" v-if="list">
    <!-- 商品顶部图片 -->
    <div class="content-img">
      <img :src="imgSrc" alt="" />
    </div>

    <!-- 商品节日广告 -->
    <div class="content-ad">
      <img
        src="https://img10.360buyimg.com/umm/jfs/t1/227141/26/13032/9533/65d7ffb5F01773f15/4aeeafdde8ecce67.png"
        alt=""
      />
    </div>

    <!-- 商品描述 -->
    <div class="content-description">
      <div class="priceWrap" style="color: #f2270c">
        <b>￥</b>
        <span> {{ renderlist.price }}</span>
      </div>

      <div class="fn_wrap">
        <span v-if="iconTitle.length <= 2">{{ iconTitle[0].txt1 }}</span>
        <div v-else>
          <img :src="iconTitle[0].url1" alt="" />
          <img :src="iconTitle[1].url1" alt="" v-if="iconTitle[1].url1" />
        </div>

        <h4>{{ renderlist.name }}</h4>
      </div>
    </div>

    <div>没有更多介绍了，直接付钱吧</div>
    <div style="text-align: center; padding-top: 40px; font-size: 18px">为你推荐</div>
    <!-- 猜你喜欢 -->
    <div class="content-Youlike">
      <filmsShow />
    </div>
  </div>
</template>

<script lang="ts" setup>
import filmsShow from '@/views/index/films/components/films-show.vue'
//props
const props = defineProps(['list'])

//拿出数据
const renderlist = computed(() => {
  if (props.list) {
    return props.list[0]
  }
  return
})

//图片
const imgSrc = computed(() => {
  return renderlist.value.imgprefix + renderlist.value.imgbase
})

//标签
const iconTitle = computed(() => {
  return renderlist.value.ext.icon
})
</script>

<style scoped>
.content-img {
  width: 375px;
  height: 375px;
  background-color: skyblue;
}
.content-img > img {
  width: 100%;
}
.content-ad {
  widows: 100%;
  height: 50px;
  background-color: pink;
}
.content-ad > img {
  width: 100%;
}
.content-description {
  width: 100%;
  height: 144px;
  background-color: #fff;
  box-sizing: border-box;
  padding: 12px 18px;
}

.content-description > .priceWrap {
  height: 35px;
}
.content-description > .priceWrap > b {
  font-size: 16px;
  margin-right: 1px;
}

.content-description > .fn_wrap {
  height: 66px;
  overflow: hidden;
}
.fn_wrap > span,
.fn_wrap img {
  font-size: 18px;
  color: red;
  display: block;
  height: 16px;
  margin-right: 6px;
}

.fn_wrap > div {
  display: flex;
}

.fn_wrap h4 {
  font-size: 14px;
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.content-Youlike {
  width: 100%;
  height: 435px;
  background-color: #fff;
  margin-top: 12px;
}
.content-introduce {
  width: 100%;
  height: 435px;
  background-color: blue;
  margin-top: 12px;
}
</style>
